package value_object;

//import information.Strip;

import java.util.ArrayList;
import java.util.List;

import value_object.data.Acquisition;

public class SolutionVO extends VO {
	private List<Acquisition> acquisitionList;

	public SolutionVO() {
		super();
		acquisitionList = new ArrayList<Acquisition>();
	}
	
	public SolutionVO(SolutionVO solution) {
		
		this.acquisitionList = solution.getAcquisitionList();
	}
	
	public SolutionVO(int data_set_number, int grid_number, int track_number) {
		super(data_set_number, grid_number, track_number);
		acquisitionList = new ArrayList<Acquisition>();
	}
	
	public List<Acquisition> getAcquisitionList() {
		return acquisitionList;
	}

	public void setAcquisitionList(List<Acquisition> acquisitionList) {
		this.acquisitionList = acquisitionList;
	}

	public void addAcquisition(Acquisition acquisition) {
		getAcquisitionList().add(acquisition);
	}
	
	public void addAcquisition(int index, Acquisition acquisition) {
		getAcquisitionList().add(index, acquisition);
	}
	
	public void removeAcquisition(int index) {
		getAcquisitionList().remove(index);
	}
	
	public int getNumberOfAcquisitions() {
		return getAcquisitionList().size();
	}

	@Override
	public String toString() {
		if (getAcquisitionList().size() <= 0)
			return "";
		
		StringBuffer buffer = new StringBuffer();

		buffer.append(getData_set_number() + "(data-set-number)");
		buffer.append(" ");
		buffer.append(getGrid_number() + "(grid-number)");
		buffer.append(" ");
		buffer.append(getTrack_number() + "(track-number)");

		buffer.append("\n");

		buffer.append(this.getAcquisitionList().size() + "(acquisition-number)");

		buffer.append("\n");

		for (int i = 0; i < this.getAcquisitionList().size(); i++) {
			buffer.append(this.getAcquisitionList().get(i).toString());
			buffer.append("\n");
		}

		return buffer.toString();
	}
	
	public String toSimpleString() {
		if (getAcquisitionList().size() <= 0)
			return "";
		
		StringBuffer buffer = new StringBuffer();

		buffer.append(getData_set_number());
		buffer.append(" ");
		buffer.append(getGrid_number());
		buffer.append(" ");
		buffer.append(getTrack_number());

		buffer.append("\n");

		buffer.append(this.getAcquisitionList().size());

		buffer.append("\n");

		for (int i = 0; i < this.getAcquisitionList().size(); i++) {
			buffer.append(this.getAcquisitionList().get(i).toSimpleString());
			buffer.append("\n");
		}

		return buffer.toString();
	}
}
